Type-Aware Linting
code:ts
async function run() {
doSomethingAsync(); // ← await していない
}
型安全でない代入(no-unsafe-assignment) code:ts
let value: number;
const data: any = "hello";
value = data; // ← any → number は危険
code:ts
type User = { id: number };
const u: User = { id: "abc" }; // ← string は不正
関数の戻り値の型に基づくチェック
code:ts
function getUser(): User | null {
return null;
}
const user = getUser();
console.log(user.id); // ← null の可能性を無視
型に基づく条件分岐の到達不能コード検出
code:ts
function f(x: never) {
if (typeof x === "string") { } // ← 到達不能
}